#pragma once

#include "BufferedSocket.h"
#include "TCPServer.h"
#include "Timer.h"

namespace Core
{
	class Telnet;

	class TelnetClient
	{
	private:
		Telnet& m_Telnet;

	public:
		BufferedSocket TelnetSocket;

		TelnetClient(Socket& p_Socket, Telnet& p_Telnet);
		void Process();
		void Send(std::string p_Message);
	};

	class Telnet : public TCPServer, public Timer
	{
	private:
		std::list<TelnetClient*> m_TelnetClients;

	public:
		Telnet(unsigned short p_PortNumber);
		void ExecuteByInterval();
		virtual void ConnectionReceived(Socket& p_Socket);
		virtual void ConnectionReceived(TelnetClient* p_TelnetClient) {};
		virtual void MessageReceived(TelnetClient* p_TelnetClient, std::string p_Message) {};
	};
}